package com.societyGames.faceExercises
{
import com.greensock.TweenNano;
import com.societyGames.action.Action;

import flash.display.DisplayObject;

public class FadeImageAction extends Action
{
  private var _displayObject:DisplayObject;
  private var _alpha:Number;
  private var _duration:Number;

  public function FadeImageAction(displayObject:DisplayObject, alpha:Number, duration:Number)
  {
    this._displayObject = displayObject;
    this._alpha = alpha;
    this._duration = duration;
  }

  public override function startAction():void
  {
    TweenNano.to(_displayObject, _duration, {alpha: _alpha, onComplete: onComplete});
  }

  protected function onComplete():void
  {
    this._completeEventObject.dispatchEvent();
  }
}
}